// BWTool.h -- interface for bork stitch tools

#import <Cocoa/Cocoa.h>
#import "BWLayer.h" // for BWLayerKind type

@class BWLayerSet;
@class BWLayerView;
@class BWGridGeometry;

typedef enum {
    kCapability_None            = 0x0000,
    kCapability_CrossStitch     = 0x0001,
    kCapability_BackStitch      = 0x0002,
    kCapability_Selection       = 0x0004,

    kCapability_TopLayer        = 0x0008,
    kCapability_AllLayers       = 0x0010

} BWToolCapabilityFlags;

@interface BWTool : NSResponder
{
    BWLayerSet *layers;
    BWGridGeometry *geometry;
    BWLayerView *layerView;
}

- (id) initWithGeometry: (BWGridGeometry *) geometry
                 layers: (BWLayerSet *) layers
              layerView: (BWLayerView *) layerView;

- (unsigned int) capabilities;

- (NSString *) name;

@end // BWTool


// subclasses welcome to override these

@interface BWTool(EventHandling)

- (BOOL) handleMouseDown: (NSEvent *) event
                 atPoint: (NSPoint) mouse;

- (void) handleMouseDragged: (NSEvent *) event
                    atPoint: (NSPoint) mouse;

- (void) handleMouseUp: (NSEvent *) event
               atPoint: (NSPoint) mouse;

- (void) handleKeyDown: (NSEvent *) event
               atPoint: (NSPoint) mouse;

- (void) handleKeyUp: (NSEvent *) event
             atPoint: (NSPoint) mouse;

- (void) handleFlagsChanged: (NSEvent *) event
                    atPoint: (NSPoint) mouse;

@end // Event Handling


@interface BWTool(HandyUtilities)

- (void) invalidateAll;

- (void) invalidateRow: (int) row
                column: (int) column;

- (void) invalidateRectAt: (int) row
                   column: (int) column
                      row: (int) row2
                   column: (int) column2;

- (id) pickLayerForKind: (BWLayerKind) kind;
- (NSArray *) allLayersForKind: (BWLayerKind) kind;

@end // Handy Utilities


@interface BWTool(Communication)

- (NSArray *) affectedLayers;

@end // Communication
